﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KVB.Common;
using Customer_Profile.Admin;
using Customer_Profile.eCardReport.DBDao;
using System.Data;
using System.Data.SqlClient;

namespace Customer_Profile.Admin
{
    public partial class SuperSQL : System.Web.UI.Page
    {
        string strUserName = "";
        string strUserID = "";
        string strEntity = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            Comm.CheckSession(this.Page, "/login.aspx", "usermodel");
            if (Session["usermodel"] != null)
            {
                strUserID = ((UserInfoEntity)Session["usermodel"]).UserLoginId;
                strUserName = ((UserInfoEntity)Session["usermodel"]).UserName;
                strEntity = ((UserInfoEntity)Session["usermodel"]).UserOffice;                
            }
            else
            {
                Log.WriteDefaultLog("main_01 Page_Load", "Session is null");
                return;
            }
          
            string strURL = HttpContext.Current.Request.Url.AbsolutePath;
            bool bok = Comm.ifhasright(strUserID, strURL);
            if (!bok)
            {
                Response.Write("你无权访问此页面");
                Response.End();
            }

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            gridbind();
        }

        protected void GridView1_PageIndexChanged(object sender, EventArgs e)
        {
            
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            gridbind();
        }

        private void gridbind()
        {
            string strTemp = TextBox1.Text.Trim();
            DataSet ds = ReportDao.DairySumReport(strTemp);
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
    }
}